package test;

import java.io.IOException;
import java.io.InputStream;

public class RunBat {   
	public static void main(String[] args) {
		new RunBat().RunBatFile();
	}
    public void RunBatFile(){    
        String command = "D:\\test.bat";    
        //String command = "D:\\test.bat";    
        try {    
            Process child = Runtime.getRuntime().exec(command);    
            InputStream in = child.getInputStream();    
            int c;    
            while ((c = in.read()) != -1) {    
                System.out.print((char)c);    
            }    
            in.close();    
            try {    
                child.waitFor();    
            } catch (InterruptedException e) {    
                // TODO Auto-generated catch block    
                e.printStackTrace();    
            }    
            System.out.println("done");    
        } catch (IOException e) {    
            // TODO Auto-generated catch block    
            e.printStackTrace();    
        }    
    }    
}   